	$(document)
			.ready(
					
					function() {
						
	 /* function($){ $.fn.extend({*/
	 
	/***********************************************************
	 * ****** 当调用dialog时，需要方式事件被多次执行 ==>使用unbind,bind方法 ******
	 * shown方法也要unbind ==> bind ==>
	 * modal("show"),防止options的值没有传入 ******
	 **********************************************************/
	/*function judgeauthority(){
		var usr_id= $("#spanCookie1").html();
		if(usr_id==null){
			
		}
	}*/
	showCrrTransferDialog = function() {
		// 定义返回类型和返回json格式
	// var crr_id = options.crr_id;
	var defaults = {
		callbackFn : null
	};
	// var config = $.fn.extend(defaults, options || {});
/*	var resultObj = {
		result : false
	};*/
	$("#crrTransferDialog").modal({
		backdrop : true,
		keyboard : false,
		show : true
	});
	$("#crrTransferDialog_xfrPosInput").attr({
	'disabled' : false
	});
	$("#crrTransferDialog_crrIdInput").attr({
	'disabled' : false
	});
	$("#crrTransferDialog_xfrPatiInput").attr({
	'disabled' : false
	});
	$("#crrTransferDialog_xfrZoneInput").attr({
	'disabled' : false
	});
	clear();
	// var
	// crrInfo=this.$("#crrTransferDialog_crrIdInput").val();
	dialogShowFnc();
	/** * 将Div实例化为modal窗体 ** */
	
	/*******************************************************
	 * (1)show:false 则需要执行modal('show')方法
	 * (2)需要unbind('show')，避免 未获取options传过来的数据之前,就showDialog
	 ******************************************************/
	
	/*******************************************************
	 * 当多次弹出对话框的同时也会多次绑定click事件。 解决办法: 在show Dialog时将click
	 * unbind全部掉 然后再绑定，这样就只剩下一个click事件了。
	 ******************************************************/
	$("#crrTransferDialog").unbind("shown.bs.modal");
	//$("#crrTransferDialog_f5confirm_Btn").unbind('click');
	//						$(".radioFunc").unbind('click');
	$("#crrTransferDialog_xfrToStockerSelect").unbind(
	'change');
	$("#crrTransferDialog_xfrToToolSelect")
	.unbind('change');
	$("#crrTransferDialog").modal("show");
	$("#crrTransferDialog_f5confirm_Btn").click(
				function(){ 
					dialogf5UpdateFnc();
				});
	dialogShowFnc();
	
	$("#crrTransferDialog_xfrToStockerSelect").change(
			function() {
				iniStockerPartition();
			});
	
	$("#crrTransferDialog_xfrToToolSelect").change(
	function() {
		iniToToolPort();
	});
	
	/*
	 * $(".radioFunc").click(function(){ alert(1);
	 * initRadio(); });
	 */
	/*******************************************************
	 * 弹出提示,当获取焦点时 需要包括: bootstrap-tooltip.js
	 ******************************************************/
	$("[rel=tooltip]").tooltip({
	placement : "bottom",
	trigger : "focus",
	animation : true,
		});
	}
	/* }); */
	/* }(jQuery); */
	$(".radioFunc").click(function() {
		 initRadio();
	});
	var pop = new PopupLayer({
		trigger : "#eleTrigger",
	popupBlk : "#blk3",
	closeBtn : "#close3",
		useOverlay : true,
		useFx : true
	});
	
	pop.doEffects = function(way) {
		if (way == "open") {
	this.popupLayer
			.css({
				opacity : 0.3
			})
			.show(
					300,
					function() {
						this.popupLayer
								.animate(
										{
											left : ($(
													window)
													.width() - this.popupLayer
													.width()) / 2,
											top : 75,
											opacity : 0.8
										},
										300,
										function() {
											this.popupLayer
													.css(
															"opacity",
																1)
											}.binding(this));
						}.binding(this));
		comBean.loadCrrInfo();
	} else {
		this.popupLayer.animate({
			left : this.trigger.offset().left,
			top : this.trigger.offset().top,
			opacity : 0.1
		}, {
			duration : 200,
			complete : function() {
				this.popupLayer.css("opacity", 1);
					this.popupLayer.hide()
				}.binding(this)
			});
		}
	};
	
	var pop1 = new PopupLayer({
		trigger : "#eleTrigger1",
	popupBlk : "#blk1",
	closeBtn : "#close1",
		useOverlay : true,
		useFx : true
	});
	
	pop1.doEffects = function(way) {
		if (way == "open") {
	this.popupLayer
			.css({
				opacity : 0.3
			})
			.show(
					300,
					function() {
						this.popupLayer
								.animate(
										{
											left : ($(
													window)
													.width() - this.popupLayer
													.width()) / 2,
											top : 75,
											opacity : 0.8
										},
										300,
										function() {
											this.popupLayer
													.css(
															"opacity",
																1)
											}.binding(this));
						}.binding(this));
		comBean.loadCrrInfo();
	} else {
		this.popupLayer.animate({
			left : this.trigger.offset().left,
			top : this.trigger.offset().top,
			opacity : 0.1
		}, {
			duration : 200,
			complete : function() {
				this.popupLayer.css("opacity", 1);
					this.popupLayer.hide()
				}.binding(this)
			});
		}
	};
	var pop2 = new PopupLayer({
		trigger : "#eleTrigger2",
	popupBlk : "#blk2",
	closeBtn : "#close2",
		useOverlay : true,
		useFx : true
	});
	
	pop2.doEffects = function(way) {
		if (way == "open") {
	this.popupLayer
			.css({
				opacity : 0.3
			})
			.show(
					200,
					function() {
						this.popupLayer
								.animate(
										{
											left : ($(
													window)
													.width() - this.popupLayer
													.width()) / 2,
											top : 75,
											opacity : 0.8
										},
										200,
										function() {
											this.popupLayer
													.css(
															"opacity",
																1)
											}.binding(this));
						}.binding(this));
		comBean.loadStkInfoFnc();
	} else {
		this.popupLayer.animate({
			left : this.trigger.offset().left,
			top : this.trigger.offset().top,
			opacity : 0.1
		}, {
			duration : 200,
			complete : function() {
				this.popupLayer.css("opacity", 1);
					this.popupLayer.hide()
				}.binding(this)
			});
		}
	};
	if (navigator.userAgent.indexOf("MSIE") > 0) {
	$("#navBar").remove();
	$("#progressDiv").remove();
	$("#layout").remove();
	alert("IE暂不支持，请使用Firefox(火狐)、Google Chrome(谷歌)等浏览器！");
		return false;
	}
	
	var dataList;
	var dataList1;
	var dateListOperCrrCnt;
	var stkLayOutInfo;
	var crrInforOnPort;
	var stkPortInfor;
	var stkCrrListInfor;
	var TransfercrrInfo;
	var EqptBayInfo;
	var _NORMAL = "0000000";
	var openEqpt = "";
	var changeFlg;
	var changeTime;
	var changeInter;
	var navBarHeight = $("#navBar").height();
	var layoutWidthWithUnit = $("svg").attr("width");
	var layoutWidth = layoutWidthWithUnit.substring(0,
			layoutWidthWithUnit.length - 2);
	var layoutHeightWithUnit = $("svg").attr("height");
	var layoutHeight = layoutHeightWithUnit.substring(0,
			layoutHeightWithUnit.length - 2);
	var shift = -50;
	var $progress = $("#progress");
	var layout = document.getElementById("layout");
	var valueNow = 0;
	var loadCmpFlg = "N";
	var timeGap = 5000;// unit:second
	var pageX;
	var pageY;
	var iniPageX;
	var iniPageY;
	var scrollX;
	var scrollY;
	var roomArray = new Array;
	for ( var i = 0; i < 35; i++) {
		roomArray[i] = (i + 1) / 5;
	}
	var count = 4;
	var aryLen = roomArray.length;
	
	var eqStatusToColor = {
		IDLE : "#F2F20C",
	RUN : "#27E527",
	DOWN : "#E74C3C",
	ENG : "#008080",
	OTHE : "#FF00FF",
	PM : "#0000CD"
	};
	var ptStatusToColor = {
		BUSY : "#27E527",
	DOWN : "#E74C3C",
	LDRQ : "#007FFF",
	LDCM : "#56FFFF",
	UDRQ : "#F2F20C",
	UDCM : "#F77BB7"
	};
	
	// 机台填充颜色
	function fetchData() {
		$.ajax({
			type : "post",
	url : "eqStatQuery.action",
	dataType : "json",
	data : {},
	timeout : 60000,
	success : function(data) {
		dataList = data.aeqptstList;
		addColor(data);
		$("#refTime").html(
	"上次更新时间：" + data.sysTimestamp);
			}
		});
	}
	// 手动搬送指令
	function TxfInfo() {
		$.ajax({
			type : "post",
	url : "crrTxfQuery.action",
	dataType : "json",
			data : {
				seldata : seldata
			},
			timeout : 60000,
			success : function(data) {
				dataList = data.aeqptstList;
				addColor(data);
			}
		});
	}
	// 功能
	fetchData();
	addWheelEffect();
	progress();
	autoRefresh(timeGap);
	$("#stockrBusyDialog").hide();
	
	// 屏蔽鼠标右键
	$(document).bind("contextmenu", function(e) {
		return false;
	});
	// 显示对话框
	function dialogShowFnc() {
		// $("#crrTransferDialog input").val(crr_id);
	$("#crrTransferDialog select").css({
	"width" : "170"
	});
	//		
	// $("#crrTransferDialog_crrIdInput").val(crr_id);
	$("#crrTransferDialog_xfrToZoneInput").val("103");
	$('input[name="radioName"]').get(0).checked = true;
	initRadio();
	// 查询卡匣传送位置
	$("#crrTransferDialog_crrIdInput").change(function() {
		queryCrrXfrInfo();
	});
	// 初始化Stocker代码
	iniStocker();
	// 初始化Stocker partition
	iniStockerPartition();
	// 初始化设备代码
	iniToTool();
	// 初始化设备port
		iniToToolPort();
	}
	
	// F5保存修改结果
	function dialogf5UpdateFnc() {
	/*						console.log($("#crrTransferDialog_toStockerRadio").prop(
							"checked"));*/
	if ($("#crrTransferDialog_toStockerRadio").prop(
	"checked")) {
	var to_eqpt_id = $.trim($(
			"#crrTransferDialog_xfrToStockerSelect")
			.val());
	if (!to_eqpt_id) {
		showErrorDialog("101", "Stocker代码为空！");
		return false;
	}
	var to_pati_id = $
			.trim($(
					"#crrTransferDialog_xfrToPatiSelect")
					.val());
	if (!to_pati_id) {
		showErrorDialog("102", "分区代码为空！");
		return false;
	}
	var inTrxObj = {
		trx_id : "FRPCLMXFR",
	opi_flg : 'Y',
	crr_id : $.trim($(
			"#crrTransferDialog_crrIdInput").val()),
	fr_eqpt_id : $
			.trim($("#crrTransferDialog_xfrPosInput")
					.val()),
	fr_pati_id : $.trim($(
			"#crrTransferDialog_xfrPatiInput")
			.val()),
	fr_zone_id : $.trim($(
			"#crrTransferDialog_xfrZoneInput")
			.val()),
	to_eqpt_id : to_eqpt_id,
	to_pati_id : to_pati_id,
	to_zone_id : $.trim($(
			"#crrTransferDialog_xfrToZoneInput")
			.val()),
	priority : $.trim($(
			"#crrTransferDialog_xfrPrioritySelect")
			.val()),
	user_id : $.trim($("#userId").val())
	};
	$.ajax({
				url : "update.action", // 请求的url地址
	dataType : "json", // 返回格式为json
	async : false, // 请求是否异步，默认为异步，这也是ajax重要特性
	data : {
		trxId : inTrxObj.trx_id,
		strMsg : JSON.stringify(inTrxObj)
	}, // 参数值
	type : "post", // 请求方式
	beforeSend : function() {
		// 请求前的处理
	},
	success : function(outTrxObj) {
		// 请求成功时处理
		console.log(outTrxObj.outObj);
		var outObject = JSON.parse(outTrxObj.outObj);
		console.log(outObject);
		if (outObject.rtn_code == '0000000') {
			/*resultObj.result = true;
			if (typeof config.callbackFn == 'function') {
				config
						.callbackFn(resultObj);
			}*/
			showSuccessDialog("指令发送成功");
		} else if(outObject.rtn_code == '1010003'){
			showErrorDialog("102","指令发送失败");
		} else if ($("#crrTransferDialog_toToolRadio")
				.prop("checked")) {
			var to_eqpt_id = $
					.trim($(
							"#crrTransferDialog_xfrToToolSelect")
							.val());
			if (!to_eqpt_id) {
				showErrorDialog("103",
						"设备代码为空！");
				showErrorDialog("指令发送失败");
				return false;
			}
		}
		clear();
	},
	complete : function() {
		// 请求完成的处理
	},
	error : function(XMLHttpRequest,
			textStatus, errorThrown) {
		showErrorDialog(500,"指令发送失败");
		/*
		 * alert(XMLHttpRequest.status);
		 * alert(XMLHttpRequest.readyState);
		 * alert(textStatus);
		 */
				},
			});
	
	var to_port_id = $
			.trim($(
					"#crrTransferDialog_xfrToPortSelect")
					.val());
	if (!to_port_id) {
		showErrorDialog("104", "端口代码为空！");
		return false;
	}
	
	var inTrxObj = {
		trx_id : "FRPCLMXFR",
	opi_flg : 'Y',
	crr_id : $.trim($(
			"#crrTransferDialog_crrIdInput").val()),
	fr_eqpt_id : $
			.trim($(
					"#crrTransferDialog_xfrPosInput")
					.val()),
	fr_pati_id : $.trim($(
			"#crrTransferDialog_xfrPatiInput")
			.val()),
	fr_zone_id : $.trim($(
			"#crrTransferDialog_xfrZoneInput")
			.val()),
	to_eqpt_id : to_eqpt_id,
	to_port_id : to_port_id,
	priority : $.trim($(
			"#crrTransferDialog_xfrPrioritySelect")
			.val()),
	user_id : $.trim($("#userId").val())
	};
	$
			.ajax({
				url : "update.action", // 请求的url地址
	dataType : "json", // 返回格式为json
	async : false, // 请求是否异步，默认为异步，这也是ajax重要特性
	data : {
		trxId : inTrxObj.trx_id,
		strMsg : JSON.stringify(inTrxObj)
	}, // 参数值
	type : "post", // 请求方式
	beforeSend : function() {
		// 请求前的处理
	},
	success : function(outTrxObj) {
		// 请求成功时处理
		// var outTrxObj-=
		// JSON.parse(outObj);
		if (outTrxObj.rtn_code == '0000000') {
			//resultObj.result = true;
			/*if (typeof config.callbackFn == 'function') {
				config
						.callbackFn(resultObj);
			}*/
		}
		$('#crrTransferDialog').modal(
				"hide");
	},
	complete : function() {
		// 请求完成的处理
	},
	error : function(XMLHttpRequest,
			textStatus, errorThrown) {
		/*
		 * alert(XMLHttpRequest.status);
		 * alert(XMLHttpRequest.readyState);
		 * alert(textStatus);
		 */
						},
					});
		}
	}
	//清除输入框的值
	function clear(){
		$("#crrTransferDialog_xfrPosInput").val("");
	$("#crrTransferDialog_xfrPortInput").val("");
	$("#crrTransferDialog_crrIdInput").val("");
	$("#crrTransferDialog_xfrPatiInput").val("");
	$("#crrTransferDialog_xfrZoneInput").val("");
		
	}
	function clearCrrInfo(){
		$("#sCrrId").val("");
		$("#sCrrStatus").val("");
		$("#sLotID").val("");
		$("#sProdID").val("");
		$("#sRouteID").val("");
		$("#sOpeID").val("");
		$("#sProcID").val("");
		$("#sShtCnt").val("");
		$("#sPnlCnt").val("");
		$("#sinStockTime").val();
	}
	// 初始化Radio button
	function initRadio() {
		if ($('input[name="radioName"]').get(0).checked == true) {
	$("#crrTransferDialog_xfrToToolSelect").css({
	'display' : 'none'
	});
	$("#crrTransferDialog_xfrToPortSelect").css({
	'display' : 'none'
	});
	$("#crrTransferDialog_xfrPrioritySelect").css({
	'display' : 'none'
	});
	$("#crrTransferDialog_xfrToStockerSelect").css({
	'display' : 'block'
	});
	$("#crrTransferDialog_xfrToPatiSelect").css({
	'display' : 'block'
	});
	$("#crrTransferDialog_xfrToZoneInput").css({
	'display' : 'block'
		});
	} else {
		$("#crrTransferDialog_xfrToToolSelect").css({
	'display' : 'block'
	});
	$("#crrTransferDialog_xfrToPortSelect").css({
	'display' : 'block'
	});
	$("#crrTransferDialog_xfrPrioritySelect").css({
	'display' : 'block'
	});
	$("#crrTransferDialog_xfrToStockerSelect").css({
	'display' : 'none'
	});
	$("#crrTransferDialog_xfrToPatiSelect").css({
	'display' : 'none'
	});
	$("#crrTransferDialog_xfrToZoneInput").css({
	'display' : 'none'
			});
		}
	}
	
	// 初始化stocker
	function iniStocker() {
		$("#crrTransferDialog_xfrToStockerSelect").empty();
	$
			.ajax({
				url : "stockerinit.action", // 请求的url地址
	dataType : "json", // 返回格式为json
	async : true, // 请求是否异步，默认为异步，这也是ajax重要特性
	data : {}, // 参数值
	type : "post", // 请求方式
	beforeSend : function() {
		// 请求前的处理
	},
	success : function(outTrxObj) {
		// 请求成功时处理
	stockeridInfo = outTrxObj.stockerlist.length > 1 ? outTrxObj.stockerlist
			: [ outTrxObj.stockerlist ];
	// var outTrxObj=JSON.parse(outObj);
	for ( var i = 0; i < stockeridInfo.length; i++) {
		$(
				"#crrTransferDialog_xfrToStockerSelect")
				.append(
						"<option value="
								+ stockeridInfo[i].stk_id
								+ ">"
								+ stockeridInfo[i].stk_id
								+ "</option>");
	}
	$(
			"#crrTransferDialog_xfrToStockerSelect")
				.css({
					width : 170
				});
	},
	complete : function() {
		// 请求完成的处理
	},
	error : function(XMLHttpRequest,
			textStatus, errorThrown) {
		/*
	 * alert(XMLHttpRequest.status);
	 * alert(XMLHttpRequest.readyState);
	 * alert(textStatus);
	 */
					},
				});
	}
	
	// 初始化stocker分区代码
	function iniStockerPartition() {
		$("#crrTransferDialog_xfrToPatiSelect").empty();
	var stocker_id = $.trim($(
			"#crrTransferDialog_xfrToStockerSelect").val());
	if (!stocker_id) {
		return false;
	}
	var myData = {
		stocker_id : stocker_id
	};
	var selData = JSON.stringify(myData);
	$.ajax({
				url : "stkPatitioninit.action", // 请求的url地址
	dataType : "json", // 返回格式为json
	async : true, // 请求是否异步，默认为异步，这也是ajax重要特性
	data : {
		selData : selData
	}, // 参数值
	type : "post", // 请求方式
	beforeSend : function() {
		// 请求前的处理
	},
	success : function(outTrxObj) {
		// 请求成功时处理
	// var outTrxObj-= JSON.parse(outObj);
	stkpatiinfo = outTrxObj.stkpatilist.length > 1 ? outTrxObj.stkpatilist
			: [ outTrxObj.stkpatilist ];
		for ( var i = 0; i < stkpatiinfo.length; i++) {
			$(
					"#crrTransferDialog_xfrToPatiSelect")
					.append(
							"<option value="
									+ stkpatiinfo[i].pati_id
									+ ">"
									+ stkpatiinfo[i].pati_id
									+ "</option>");
		}
	$("#crrTransferDialog_xfrToPatiSelect")
				.css({
					width : 170
				});
	},
	complete : function() {
		// 请求完成的处理
	},
	error : function(XMLHttpRequest,
			textStatus, errorThrown) {
		/*
	 * alert(XMLHttpRequest.status);
	 * alert(XMLHttpRequest.readyState);
	 * alert(textStatus);
	 */
					},
				});
	}
	
	// 查询搬送指令信息
	function queryCrrXfrInfo() {
		var crr_id = this.$("#crrTransferDialog_crrIdInput")
			.val();
	var mydata = {
		crr_id : crr_id
	};
	var selData = JSON.stringify(mydata);
	$.ajax({
		url : "CrrxfrInfoquery.action", // 请求的url地址
	dataType : "json", // 返回格式为json
	async : true, // 请求是否异步，默认为异步，这也是ajax重要特性
	data : {
		selData:selData
	}, // 参数值
	type : "post", // 请求方式
	beforeSend : function() {
		// 请求前的处理
	},
	success : function(outTrxObj) {
		// 请求成功时处理
	// var outTrxObj-= JSON.parse(outObj);
	trxinfo = outTrxObj.txfInfolist;
	console.log(typeof(trxinfo));
	console.log(trxinfo);
	console.log(trxinfo[0].xfr_port_id);
	$("#crrTransferDialog_xfrPosInput").val(
			trxinfo[0].xfr_pos_id);
	$("#crrTransferDialog_xfrPortInput").val(
			trxinfo[0].xfr_port_id);
	$("#crrTransferDialog_xfrPatiInput").val(
			trxinfo[0].xfr_pati_id);
	$("#crrTransferDialog_xfrZoneInput").val(
	trxinfo[0].xfr_zone_id);
	
	//								for(var i=0;i<trxinfo.length;i++)
			
	},
	complete : function() {
		// 请求完成的处理
	},
	error : function(XMLHttpRequest, textStatus,
			errorThrown) {
		/*
	 * alert(XMLHttpRequest.status);
	 * alert(XMLHttpRequest.readyState);
	 * alert(textStatus);
	 */
			},
		});
	}
	
	// 初始化至设备代码
	function iniToTool() {
		$("#crrTransferDialog_xfrToToolSelect").empty();
	var mydata = {
		unit_typ : "MAIN"
	}
	var selData = JSON.stringify(mydata);
	$
			.ajax({
				url : "toToolinit.action", // 请求的url地址
	dataType : "json", // 返回格式为json
	async : true, // 请求是否异步，默认为异步，这也是ajax重要特性
	data : {
		selData : selData
	}, // 参数值
	type : "post", // 请求方式
	beforeSend : function() {
		// 请求前的处理
	},
	success : function(outTrxObj) {
		// 请求成功时处理
	toolidInfo = outTrxObj.toollist.length > 1 ? outTrxObj.toollist
			: [ outTrxObj.toollist ];
	// var outTrxObj=JSON.parse(outObj);
	// var outTrxObj =JSON.parse(outTrxObj);
	for ( var i = 0; i < toolidInfo.length; i++) {
		$(
				"#crrTransferDialog_xfrToToolSelect")
				.append(
						"<option value="
								+ toolidInfo[i].toolId
								+ ">"
								+ toolidInfo[i].toolId
								+ "</option>");
	}
	// $("#crrTransferDialog_xfrToToolSelect").css({
	// width : 170
	// });
	},
	complete : function() {
		// 请求完成的处理
	},
	error : function(XMLHttpRequest,
			textStatus, errorThrown) {
		/*
	 * alert(XMLHttpRequest.status);
	 * alert(XMLHttpRequest.readyState);
	 * alert(textStatus);
	 */
					},
				});
	}
	
	// 初始化设备端口信息
	function iniToToolPort() {
		$("#crrTransferDialog_xfrToPortSelect").empty();
	var tool_id = $.trim($(
			"#crrTransferDialog_xfrToToolSelect").val());
	if (!tool_id) {
		return false;
	}
	var mydata = {
		root_tool_id : tool_id
	};
	var selData = JSON.stringify(mydata);
	$.ajax({
				url : "toToolPortinit.action", // 请求的url地址
	dataType : "json", // 返回格式为json
	async : true, // 请求是否异步，默认为异步，这也是ajax重要特性
	data : {
		selData:selData
	}, // 参数值
	type : "post", // 请求方式
	beforeSend : function() {
		// 请求前的处理
	},
	success : function(outTrxObj) {
		// 请求成功时处理
	// var outTrxObj=JSON.parse(outObj);
	toolportInfo = outTrxObj.toolportlist.length > 1 ? outTrxObj.toolportlist
			: [ outTrxObj.toolportlist ];
		for ( var i = 0; i < toolportInfo.length; i++) {
			$(
					"#crrTransferDialog_xfrToPortSelect")
					.append(
							"<option value="
									+ toolportInfo[i].portID
									+ ">"
									+ toolportInfo[i].portID
									+ "</option>");
		}
	
	$("#crrTransferDialog_xfrToPortSelect").css({
					width : 170
				});
	},
	complete : function() {
		// 请求完成的处理
	},
	error : function(XMLHttpRequest,
			textStatus, errorThrown) {
		/*
	 * alert(XMLHttpRequest.status);
	 * alert(XMLHttpRequest.readyState);
	 * alert(textStatus);
	 */
					},
				});
	}
	
	function crrOnPortInfo() {
		$.ajax({
			type : "post",
	url : "crrInfoOnPortQuery.action",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
		data : {},
		timeout : 60000,
		success : function(data) {
			crrInforOnPort = data.crrInfoOnPort;
		}
	});
	for ( var i = 0; i < crrInforOnPort.length; i++) {
		var crrID;
		var eqptPortID;
		crrID = crrInforOnPort[i].crrID;
		eqptPortID = crrInforOnPort[i].position + '-'
			+ crrInforOnPort[i].portID;
	
	var obj = document.getElementById(eqptPortID);
	if (obj != null) {
		comBean.crrOnPortAlarmFnc(eqptPortID);
	}
	
	var obj_tf_ = document.getElementById(eqptPortID
			+ "_tf_");
	if (obj_tf_ != null) {
		comBean.crrOnPortAlarmFnc(eqptPortID + "_tf_");
	}
	
	var obj_etc = document.getElementById(eqptPortID
			+ "_etc");
	if (obj_etc != null) {
		comBean.crrOnPortAlarmFnc(eqptPortID + "_etc");
	}
	
	var obj_pho = document.getElementById(eqptPortID
			+ "_pho");
	if (obj_pho != null) {
		comBean.crrOnPortAlarmFnc(eqptPortID + "_pho");
	}
	
	var obj_tst = document.getElementById(eqptPortID
			+ "_tst");
	if (obj_tst != null) {
		comBean.crrOnPortAlarmFnc(eqptPortID + "_tst");
	}
	
	var obj_fa_ = document.getElementById(eqptPortID
			+ "_fa_");
	if (obj_fa_ != null) {
		comBean.crrOnPortAlarmFnc(eqptPortID + "_fa_");
			}
	
		}
	
	}
	
	// setInterval(crrOnPortInfo,10000);
	
	// 鼠标滑过rect显示机台ID
	$("rect").hover(
	function(event) {
		var obj = event.target;
		var id = event.target.id;
		if (id.length == 12) {
			id = id.substring(0, 12);
		} else if (id.length == 15) {
			id = id.substring(0, 11);
		}
		if (id == "" || id == undefined || id == null
			|| id.length > 12)
		return false;
	var clientX = event.pageX;
	var clientY = event.pageY;
	$("#tipDiv").text(id).css({
	"left" : clientX,
	"top" : clientY + shift
		}).stop(true, true).show();
	}, function() {
		$("#tipDiv").hide();
	$("#StockerCrrInfo").hide();
	});
	
	// 对机台模块监控鼠标左右键
	$(".eqptCss").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
		showCrrList(event);
	}
	if (event.which == 3 || a == 'right') {
			showEqptInfo(event);
		}
	});
	
	// STK信息查询
	$(".stkCss").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
		showSTKInfor(event);
		ShowStockerCrrInfo();
	
	}
	if (event.which == 3 || a == 'right') {
			showMainOperWip(event);
		}
	});
	
	// 鼠标滑过PORT显示CRR信息
	// $(".portCss").hover(function(event) {
	// showCrrInfo(event);
	// },function(){
	// $("#crrInfoMenu").hide();
	// });
	$(".portCss").mousedown(function(event, a) {
	if (event.which == 3 || a == 'right') {
		showCrrInfo(event);
	}
	if (event.which == 1 || a == 'left') {
			/*showCrrTransferDialog();*/
		}
	});
	// 监控空白处鼠标左键，用于关闭右键打开的myMenu
	$("#layout").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
	$("#myMenu").hide();
	$("#mainOperWipdiv").hide();
	$("#crrInfoMenu").hide();
	$("#StockerCrrInfo").hide();
		}
	});
	$("#layout_tf_").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
	$("#myMenu").hide();
	$("#mainOperWipdiv").hide();
	$("#crrInfoMenu").hide();
	$("#StockerCrrInfo").hide();
		}
	});
	$("#layout_etc").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
	$("#myMenu").hide();
	$("#mainOperWipdiv").hide();
	$("#crrInfoMenu").hide();
	$("#StockerCrrInfo").hide();
		}
	});
	$("#layout_pho").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
	$("#myMenu").hide();
	$("#mainOperWipdiv").hide();
	$("#crrInfoMenu").hide();
	$("#StockerCrrInfo").hide();
		}
	});
	$("#layout_tst").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
	$("#myMenu").hide();
	$("#mainOperWipdiv").hide();
	$("#crrInfoMenu").hide();
	$("#StockerCrrInfo").hide();
		}
	});
	$("#layout_fa_").mousedown(function(event, a) {
	if (event.which == 1 || a == 'left') {
	$("#myMenu").hide();
	$("#mainOperWipdiv").hide();
	$("#crrInfoMenu").hide();
	$("#StockerCrrInfo").hide();
		}
	});
	$("#closeCrrImg").click(closeCrrDiv);
	
	/*$("#searchBtn").click(searchFun);*/
	
	$("#closeSearchImg").click(closeSearchDiv);
	
	$("#closeCrrImg").hover(function(event) {
	$("#closeCrrImg").css({
	"background-color" : "#706c6c"
		});
	}, function() {
		$("#closeCrrImg").css({
	"background-color" : "#999999"
		});
	});
	
	$("#closeSearchImg").hover(function(event) {
	$("#closeSearchImg").css({
	"background-color" : "#a8a884"
		});
	}, function() {
		$("#closeSearchImg").css({
	"background-color" : "#e5e5da"
		});
	});
	
	// 查询机台功能
	$("#eqptIDTxt").keypress(
			function(event) {
				var key = event.which;
				if (key == 13) {
					var searchEqptID = $("#eqptIDTxt")
				.val().trim().toUpperCase();
		if (searchEqptID.length != 10) {
			showMessage("设备名称必须为10位！");
			return false;
		}
		var obj = document
				.getElementById(searchEqptID);
		if (obj == null) {
			showMessage("无此设备！");
			return false;
		}
		count = 10;
		var newLayoutWidth = layoutWidth
				* roomArray[count];
		var newLayoutHeight = layoutHeight
				* roomArray[count];
		$("svg").attr("width",
				newLayoutWidth);
		$("svg").attr("height",
				newLayoutHeight);
		$("#layoutSvg").css({
			"width" : ""
		});
		var toleft = obj.getAttribute("x")
				* roomArray[count];
		var totop = obj.getAttribute("y")
				* roomArray[count];
		var sLMove;
		var sTMove;
		if (toleft > (document.body.clientWidth / 2)) {
			sLMove = toleft
					- document.body.clientWidth
					/ 2;
		} else {
			sLMove = "0";
		}
		if ((totop + navBarHeight + 30) > (document.body.clientHeight / 2)) {
			sTMove = (totop + navBarHeight + 30)
					- (document.body.clientHeight / 2);
		} else {
			sTMove = "0";
		}
		$("#tipDiv").hide();
		$("#myMenu").hide();
		$("#crrInfoMenu").hide();
		$("#crrMenu").hide();
		$("#mainOperWipdiv").hide();
		$("#StockerCrrInfo").hide();
		window.scrollTo(sLMove, sTMove);
		changeFlg = "1";
							changeTime = 0;
							changeInter = setInterval(
									function() {
										changeFun(obj);
									}, 400);
						}
					});
	function ShowStockerCrrInfo() {
		$(".STKCrrListTbl tr td").click(
	function(event) {
		var showTime;
		$("#StockerCrrInfo").hide();
	var id = $(this).attr('id');
	//通过shelfid来获取到box_id_fk
	var xfr_shelf_id=id;
	//var xfr_shelf_id=xfr_shelf_id+"4";
	var myData={
			xfrshelfID : xfr_shelf_id
	}
	selData = JSON.stringify(myData);
	getCrrId(selData);
	var crr_id=crrIdInfos[0].crrID;
	/*var ids = $.trim($(this).text());
	if (ids == "") {
		return true;
	}
	if (ids.length > 4) {
		return true;
	}*/
	//var crr_id = "17A" + $(this).text();
	var myData = {
		crrID : crr_id,		
	};
	selData = JSON.stringify(myData);
	//getCrrInfo(selData);
	$.ajax({
		type : "post",
	url : "crrInfoQuery.action",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
	data : {
		selData : selData
	},
	timeout : 60000,
	success : function(data) {
		crrInfo = data.crrInfoList;// CRR信息
		var endTime = getNowFormatDate();
		var startTime = crrInfo[0].inStockTime;
		startTime = startTime.substring(0,
				startTime.lastIndexOf('.'));
		var inStockTimeMinute = GetDateDiff(
				startTime, endTime, "minute");
		var day = parseInt(inStockTimeMinute
				/ (24 * 60));
		var oterMinute = inStockTimeMinute
				% (24 * 60);
		var hour = parseInt(oterMinute / 60);
		var minute = oterMinute % 60;
		if (day <= 0) {
			if (hour <= 0) {
				showTime = minute + "分钟";
		} else {
			showTime = hour + "小时" + minute
					+ "分钟";
			}
		} else {
			showTime = day + "天" + hour + "小时"
				+ minute + "分钟";
		}
		clearCrrInfo();
		if (crrInfo[0].box_id) {
			$("#SCrr").html("Carrier Information");
		$("#sCrrId").text(crrInfo[0].box_id.trim());
		$("#sCrrStatus").text(crrInfo[0].crrStat.trim());
		if(crrInfo[0].lotID){
			$("#sLotID").text(crrInfo[0].lotID.trim());
		}
		if(crrInfo[0].prodID){
			$("#sProdID").text(crrInfo[0].prodID.trim());
		}
		if(crrInfo[0].routeID){
			$("#sRouteID").text(crrInfo[0].routeID.trim());
		}
		if(crrInfo[0].opeID){
			$("#sOpeID").text(crrInfo[0].opeID.trim());
		}
		if(crrInfo[0].procID){
			$("#sProcID").text(crrInfo[0].procID.trim());
		}
		$("#sShtCnt").text(crrInfo[0].shtCnt.trim());
		$("#sPnlCnt").text(crrInfo[0].pnlCnt.trim());
		$("#sinStockTime").text(showTime);
		
		}
		}
	});

	var clientX = event.pageX;
	var clientY = event.pageY;
	var tWidth = event.clientX
			+ $("#StockerCrrInfo").width()
			- document.body.clientWidth;
	var tHeight = event.clientY
			+ $("#StockerCrrInfo").height()
			- document.body.clientHeight;
	if (tWidth > 0) {
		clientX = clientX - tWidth;
	}
	if (tHeight > 0) {
		clientY = clientY - tHeight;
	}
	$("#StockerCrrInfo").css({
	"left" : clientX,
	"top" : clientY,
	"z-index" : "9"
	});
	
	$("#StockerCrrInfo").show();
				});
	}
	
	// 查询机台定位闪烁
	function changeFun(obj) {
		if (changeFlg == "1") {
	obj.setAttribute("stroke-width", "2");
	obj.setAttribute("stroke", "red");
	changeTime += 400;
	changeFlg = "2";
	} else {
		obj.setAttribute("stroke-width", "0.5");
	obj.setAttribute("stroke", "#827E7E");
	changeTime += 400;
	changeFlg = "1";
	}
	if (changeTime >= 2400) {
		obj.setAttribute("stroke-width", "0.5");
		obj.setAttribute("stroke", "#827E7E");
			clearInterval(changeInter);
		}
	}
	
	function closeCrrDiv() {
		$("#crrMenu").hide();
	$("#mainOperWipdiv").hide();
	}
	
	function closeStkDiv() {
	
		$("#_STKInfoListDiv").hide();
	}
	
	/*function searchFun() {
		$("#searchDiv").css({
	"top" : $("#navBar").height()
	});
	$("#searchDiv").slideToggle(200);
	}*/
	
	function closeSearchDiv() {
		$("#searchDiv").slideToggle(200);
	}
	
	// 自动刷新
	function autoRefresh(timeGap) {
		// timeGap *= 1000;
		setInterval(fetchData, timeGap);
	}
	
	// *********************************************获得主站点卡匣信息
	function fetchMainOperWip(selData) {
		$.ajax({
			type : "post",
	url : "mainOperCrrCntQuery.action",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
			data : {
				selData : selData
			},
			timeout : 60000,
			success : function(data) {
				dateListOperCrrCnt = data.mainOperCrrCntList;
			}
		});
	}
	// 获取STK内分布的信息及实时CRR信息
	function getStkInfor() {
		$.ajax({
			type : "post",
	url : "getStkInforQuery.action",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
	data : {
		selData : selData
	},
	timeout : 60000,
	success : function(data) {
		stkLayOutInfo = data.layout; // STK现有储位分布
	stkPortInfor = data.portInfor;// STK中显示port及机台ID
	stkCrrListInfor = data.getstkCrrList;// STK中CRR在储位的位置信息
	stkStat=data.stk_stat;//获取到stk的状态信息。
			}
		});
	}
	// 获取CRR信息
	function getCrrInfo() {
		$.ajax({
			type : "post",
	url : "crrInfoQuery.action",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
	data : {
		selData : selData
	},
	timeout : 60000,
	success : function(data) {
		crrInfo = data.crrInfoList;// CRR信息
			}
		});
	}
	//获取卡匣ID
	function getCrrId(){
		$.ajax({
			type : "post",
	url : "boxIdInfoQuery.action",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
	data : {
		selData : selData
	},
	timeout : 60000,
	success : function(data) {
		crrIdInfos = data.boxIdList;// CRR信息
			}
		});	
	}
	function getCrrTransferInfo() {
		$
				.ajax({
					type : "post",
	url : "crrInfo/loadCrrSort",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
	timeout : 60000,
	success : function(data) {
		TransfercrrInfo = data.dcarrixfPOList.length > 1 ? data.dcarrixfPOList
				: [ data.dcarrixfPOList ];// CRR信息
					}
				});
	}
	// 获取bay信息
	function getEqptBayInfo() {
		$.ajax({
			type : "post",
	url : "crrInfo/eqptBayInfoQuery",
	dataType : "json",
	async : false, // 决定ajax是否异步执行
	// data : {
	// selData : selData
	// },
	timeout : 60000,
	success : function(data) {
		EqptBayInfo = data.stockerPOList;// CRR信息
			}
		});
	}
	
	function getNowFormatDate() {
		var date = new Date();
		var seperator1 = "-";
	var seperator2 = ":";
	var month = date.getMonth() + 1;
	var strDate = date.getDate();
	if (month >= 1 && month <= 9) {
		month = "0" + month;
	}
	if (strDate >= 0 && strDate <= 9) {
		strDate = "0" + strDate;
	}
	var currentdate = date.getFullYear() + seperator1
			+ month + seperator1 + strDate + " "
				+ date.getHours() + seperator2
				+ date.getMinutes() + seperator2
				+ date.getSeconds();
		return currentdate;
	
	}
	/*
	 * 获得时间差,时间格式为 年-月-日 小时:分钟:秒 或者 年/月/日 小时：分钟：秒 其中，年月日为全格式，例如 ：
	 * 2010-10-12 01:00:00 返回精度为：秒，分，小时，天
	 */
	function GetDateDiff(startTime, endTime, diffType) {
		// 将xxxx-xx-xx的时间格式，转换为 xxxx/xx/xx的格式
	startTime = startTime.replace(/\-/g, "/");
	endTime = endTime.replace(/\-/g, "/");
	// 将计算间隔类性字符转换为小写
	diffType = diffType.toLowerCase();
	var sTime = new Date(startTime); // 开始时间
	var eTime = new Date(endTime); // 结束时间
	// 作为除数的数字
	var divNum = 1;
	switch (diffType) {
	case "second":
		divNum = 1000;
		break;
	case "minute":
		divNum = 1000 * 60;
		break;
	case "hour":
		divNum = 1000 * 3600;
		break;
	case "day":
			divNum = 1000 * 3600 * 24;
			break;
		default:
			break;
		}
		return parseInt((eTime.getTime() - sTime.getTime())
				/ parseInt(divNum));
	}
	
	// *********************************************
	
	function progress() {
		valueNow += 5;
		$progress.css("width", valueNow + "%");
	var t = setTimeout(progress, 10);
	if (loadCmpFlg == "Y" || valueNow == 4000) {
		clearInterval(t);
		$(".progress").hide();
		$("#layout").show();
		$("#layoutSvg").css({
			"width" : "100%"
	});
//	if (valueNow == 4000) {
//		showMessage("异常，请重新刷新页面！");
//	}
		}
	}
	
	function addColor(data) {
		for ( var i = 0; i < data.aeqptstList.length; i++) {
			var id = data.aeqptstList[i].eqptID.trim();
			var status = data.aeqptstList[i].eqptStat.trim();
			var obj = document.getElementById(id);
			var color = eqStatusToColor[status];
			if (obj != null) {
				obj.setAttribute("fill", color);
	}
	
	var id_tf_ = id + "_tf_";
	var obj_tf_ = document.getElementById(id_tf_);
	if (obj_tf_ != null) {
		obj_tf_.setAttribute("fill", color);
	}
	
	var id_etc = id + "_etc";
	var obj_etc = document.getElementById(id_etc);
	if (obj_etc != null) {
		obj_etc.setAttribute("fill", color);
	}
	
	var id_pho = id + "_pho";
	var obj_pho = document.getElementById(id_pho);
	if (obj_pho != null) {
		obj_pho.setAttribute("fill", color);
	}
	
	var id_tst = id + "_tst";
	var obj_tst = document.getElementById(id_tst);
	if (obj_tst != null) {
		obj_tst.setAttribute("fill", color);
	}
	
	var id_fa_ = id + "_fa_";
	var obj_fa_ = document.getElementById(id_fa_);
	if (obj_fa_ != null) {
		obj_fa_.setAttribute("fill", color);
		}
	}
	for ( var i = 0; i < data.aeqptptList.length; i++) {
		var id = data.aeqptptList[i].eqptID.trim() + "-"
			+ data.aeqptptList[i].portID.trim();
		if(data.aeqptptList[i].portStat){
			var status = data.aeqptptList[i].portStat.trim();
		}
	var obj = document.getElementById(id);
	var color = ptStatusToColor[status];
	if (obj != null) {
		obj.setAttribute("fill", color);
	}
	
	var id_tf_ = id + "_tf_";
	var obj_tf_ = document.getElementById(id_tf_);
	if (obj_tf_ != null) {
		obj_tf_.setAttribute("fill", color);
	}
	
	var id_etc = id + "_etc";
	var obj_etc = document.getElementById(id_etc);
	if (obj_etc != null) {
		obj_etc.setAttribute("fill", color);
	}
	
	var id_pho = id + "_pho";
	var obj_pho = document.getElementById(id_pho);
	if (obj_pho != null) {
		obj_pho.setAttribute("fill", color);
	}
	
	var id_tst = id + "_tst";
	var obj_tst = document.getElementById(id_tst);
	if (obj_tst != null) {
		obj_tst.setAttribute("fill", color);
	}
	
	var id_fa_ = id + "_fa_";
	var obj_fa_ = document.getElementById(id_fa_);
	if (obj_fa_ != null) {
		obj_fa_.setAttribute("fill", color);
		}
	}
	
	$("rect[id]").each(
	function(i) {
		var fillColor = $(this).attr("fill");
	if (fillColor == "none"
		|| fillColor == "undefined")
	$(this).attr("fill", "#FF00FF");
			});
	loadCmpFlg = "Y"; // 等待条判断机台状态加载完成
	}
	
	function addWheelEffect() {
		if (window.addEventListener)
			window.addEventListener("DOMMouseScroll", wheel,
					false);
		window.onmousewheel = document.onmousewheel = wheel;
	}
	
	function wheel(event) {
		var delta = 0;
		if (!event)
			event = window.event;
		if (event.wheelDelta) {
			delta = event.wheelDelta / 120;
		} else if (event.detail) {
			delta = -event.detail / 3;
		}
		navBarHeight = $("#navBar").height();
	pageX = event.pageX;
	pageY = event.pageY;
	iniPageX = pageX / roomArray[count];
	iniPageY = (pageY - navBarHeight - 30)
			/ roomArray[count]; // 30为上边距
	// scrollX = this.scrollX;
	// scrollY = this.scrollY;
		scrollX = document.body.scrollLeft;
		scrollY = document.body.scrollTop;
		if (delta)
			handle(delta);
	
		if (event.preventDefault)
			event.preventDefault();
		event.returnValue = false;
	}
	
	function handle(delta) {
		if (delta > 0) {
			count++;
			if (count > aryLen - 1) {
				count = aryLen - 1;
				return;
			}
		} else {
			if (document.body.scrollWidth == document.body.clientWidth
					&& document.body.scrollHeight == document.body.clientHeight) {
				return;
			}
			count--;
			if (count < 0) {
				count = 0;
				return;
			}
		}
		magnifyLayout();
	}
	
	function magnifyLayout() {
		var newLayoutWidth = layoutWidth * roomArray[count];
		var newLayoutHeight = layoutHeight * roomArray[count];
		if ($("#opeSel").val() === "ALL") {
	$("#layoutSvg").attr("width", newLayoutWidth);
	$("#layoutSvg").attr("height", newLayoutHeight);
	} else if ($("#opeSel").val() === "TF") {
	$("#tf").attr("width", newLayoutWidth);
	$("#tf").attr("height", newLayoutHeight);
	} else if ($("#opeSel").val() === "ETCH") {
	$("#etch").attr("width", newLayoutWidth);
	$("#etch").attr("height", newLayoutHeight);
	} else if ($("#opeSel").val() === "PHO") {
	$("#pho").attr("width", newLayoutWidth);
	$("#pho").attr("height", newLayoutHeight);
	} else if ($("#opeSel").val() === "TEST") {
	$("#test").attr("width", newLayoutWidth);
	$("#test").attr("height", newLayoutHeight);
	} else if ($("#opeSel").val() === "FA") {
	$("#fa").attr("width", newLayoutWidth);
	$("#fa").attr("height", newLayoutHeight);
	}
	$("#layoutSvg").css({
	"width" : ""
	});
	$("#tipDiv").hide();
	$("#myMenu").hide();
	$("#crrMenu").hide();
	$("#mainOperWipdiv").hide(); // 鼠标滚轮滚动时隐藏
	$("#_STKInfoListDiv").hide();
	$("#crrInfoMenu").hide();
	if (document.body.scrollWidth == document.body.clientWidth) { // firefox可用"window.scrollMaxX
													// ==
													// 0"判断
	$("#layoutSvg").css({
	"width" : "100%"
		});
	}
	if (count == 4) {
		window.scrollTo(0, 0);
	} else if (count > 4) {
		var divLeft = iniPageX * roomArray[count]
				- (pageX - scrollX);
		var divTop = iniPageY * roomArray[count]
				+ navBarHeight + 30 - (pageY - scrollY); // 30为上边距
			window.scrollTo(divLeft, divTop);
		} else {
			return;
		}
	}
	
	// 报错框
	function showMessage(content) {
		$.globalMessenger().post({
			message : content,
			type : 'error',
			hideAfter : 2,
			hideOnNavigate : true
		});
	}
	
	function showCrrList(event) {
		var id = event.target.id;
		id = id.substring(0, 5);
		if (id == "" || id == null || id == undefined
			|| id.length > 9) {
		return false;
	}
	if (id == openEqpt
			&& $("#crrMenu").is(':visible') == true) {
	$("#crrMenu").hide();
		return;
	}
	for ( var i = 0; i < dataList.length; i++) {
		if (id == dataList[i].eqptID) {
			$("#crrTitle").html(
	"Transfer Status - ["
			+ dataList[i].eqptDsc.trim()
			+ "(" + dataList[i].eqptID
			+ ")]");
			break;
		}
	}
	
	var floatData = "right";
	// var divLeft = event.pageX - event.clientX;
	var divLeft = "0";
	// var divTop = event.pageY - event.clientY +
	// $("#navBar").height();
	var divTop = $("#navBar").height();
	if (event.clientX < document.body.clientWidth / 2) {
		divLeft = divLeft + document.body.clientWidth
				- $("#crrMenu").width() - 2;
	floatData = "left";
	}
	$("#closeCrrImg").css({
	"float" : floatData
	});
	
	$("#crrMenu").css({
	"left" : divLeft,
	"top" : divTop,
	"z-index" : "7"
	});
	
	$("#crrListGrd").jqGrid("clearGridData");
	var eqptid=id+"1000";
	var myData = {
		eqptID : eqptid
	}
	selData = JSON.stringify(myData);
	
	if ($("#loadingImgDiv").length > 0) {
	$("#loadingImgDiv").remove();
	}
	
	var strLoadingImgDiv = '<div id="loadingImgDiv" align="center"><img id="loadingImg" src="image/loading.gif" /></div> ';
	$(strLoadingImgDiv).appendTo("body");
	$("#loadingImgDiv").css({
	"position" : "fixed",
	"width" : "100%",
	"height" : "100%",
	"opacity" : "0.5",
	"background-color" : "#999999",
	"z-index" : "100"
	});
	
	$.ajax({
		type : "post",
	url : "transfterQuery.action",
	dataType : "json",
	data : {
		selData : selData
	},
	beforeSend : function() {
		$("#loadingImgDiv").show();
	},
	complete : function() {
		$("#loadingImgDiv").hide();
	},
	success : function(data) {
		if (data.transfterList != ""
		&& data.transfterList != null
		&& data.transfterList != undefined) {
	if (data.transfterList.length) {
		$("#crrListGrd").jqGrid('setGridParam',
			{
				datatype : 'local',
				data : data.transfterList
			}).trigger("reloadGrid");
	} else {
		$("#crrListGrd").jqGrid("addRowData",
			"1", data.transfterList);
				}
			}
		}
	});
	
	openEqpt = id;
	$("#crrMenu").show();
	$("#mainOperWipdiv").hide();
	
	}
	
	function showMainOperWip(event) {
		var id = event.target.id;
		if (id == "" || id == null || id == undefined
			|| id.length > 8) {
		return false;
	}
	
	var myData = {
		to_eqpt_id : id
	};
	selData = JSON.stringify(myData);
	
	fetchMainOperWip(selData);
	
	var smpCnt = 0;
	var mqcCnt = 0;
	var mainCompCnt = 0;
	var emptCnt = 0;
	var mainOperWipeInfo = new Array();
	for ( var i = 0; i < dateListOperCrrCnt.length; i++) {
		if (dateListOperCrrCnt[i].crrStat == "EMPT") {
		emptCnt++;
	} else {
		if (dateListOperCrrCnt[i].routeCate == "SMP") {
			smpCnt++;
	}
	if (dateListOperCrrCnt[i].routeCate == "MQC ") {
		mqcCnt++;
	}
	if (dateListOperCrrCnt[i].routeCate == "MAN") {
	var obj = new Object();
	if (dateListOperCrrCnt[i].crrStat == "COMP") {
		mainCompCnt++;
	} else {
		if (mainOperWipeInfo.length > 0) {
			var addFlg = "Y";
		for ( var j = 0; j < mainOperWipeInfo.length; j++) {
			if (mainOperWipeInfo[j].oper == dateListOperCrrCnt[i].opeID) {
				mainOperWipeInfo[j].cnt++;
				addFlg = "N";
				break;
			}
		}
		if (addFlg == "Y") {
							obj.oper = dateListOperCrrCnt[i].opeID;
							obj.cnt = 1;
							mainOperWipeInfo.push(obj);
						}
					} else {
						obj.oper = dateListOperCrrCnt[i].opeID;
						obj.cnt = 1;
						mainOperWipeInfo.push(obj);
					}
				}
			}
		}
	}
	
	var clientX = event.pageX;
	var clientY = event.pageY;
	var tWidth = event.clientX
			+ $("#mainOperWipdiv").width()
			- document.body.clientWidth;
	var tHeight = event.clientY
			+ $("#mainOperWipdiv").height()
			- document.body.clientHeight;
	if (tWidth > 0) {
		clientX = clientX - tWidth;
	}
	if (tHeight > 0) {
		clientY = clientY - tHeight;
	}
	var mainOperWipTable = "";
	$("#myTable").html("");
	$("#stkspn").html("Opration WIP(" + id + ")");
	if (emptCnt > 0) {
		mainOperWipTable += '<tr><td id="dOper" style="color:#000000" width="50" border="1">'
	+ "EMPT"
	+ '</td><td id="dCount" style="color:#000000" width="20">'
	+ emptCnt + '</td></tr>';
	}
	if (smpCnt > 0) {
		mainOperWipTable += '<tr><td id="dOper" style="color:#CC6600" width="50" border="1">'
	+ "BSTB"
	+ '</td><td id="dCount" style="color:#CC6600" width="20">'
	+ smpCnt + '</td></tr>';
	}
	if (mqcCnt > 0) {
		mainOperWipTable += '<tr><td id="dOper" style="color:#6600FF" width="50" border="1">'
	+ "MQC"
	+ '</td><td id="dCount" style="color:#6600FF" width="20">'
	+ mqcCnt + '</td></tr>';
	}
	if (mainCompCnt > 0) {
		mainOperWipTable += '<tr><td id="dOper" style="color:#0000FF" width="50" border="1">'
	+ "MainComp"
	+ '</td><td id="dCount" style="color:#0000FF" width="20">'
	+ mainCompCnt + '</td></tr>';
	}
	
	if (mainOperWipeInfo.length > 0) {
		for ( var i = 0; i < mainOperWipeInfo.length; i++) {
			mainOperWipTable += '<tr><td id="dOper" style="color:#00CC00" width="50" border="1">'
	+ mainOperWipeInfo[i].oper
	+ '</td><td id="dCount" style="color:#00CC00" width="20">'
	+ mainOperWipeInfo[i].cnt
	+ '</td></tr>';
		}
	}
	$("#myTable").append(mainOperWipTable);
	$("#mainOperWipdiv").css({
	"left" : clientX,
	"top" : clientY,
	"z-index" : "8"
	});
	
	$("#tipDiv").hide();
	$("#myMenu").hide();
	$("#crrInfoMenu").hide();
	$("#mainOperWipdiv").show();
	}
	
	function showSTKInfor(event) {
	
		var id = event.target.id;
		if (id == "" || id == null || id == undefined
			|| id.length > 8) {
		return false;
	}
	
	var myData = {
		stk_id : id
	};
	selData = JSON.stringify(myData);
	getStkInfor(selData);
	
	var stkPortInforArray = new Array();
	stkPortInforArray = stkPortInfor.split('/');
	/*var stkstat=stkStat[0];
	var stk_stat=stkstat.stk_stat;
	if(stk_stat=="RUN"){
		var obj = document.getElementById(id);
		obj.setAttribute("fill", "#27E527");
	}
	if(stk_stat=="DOWN"){
		var obj = document.getElementById(id);
		obj.setAttribute("fill", "#E74C3C");
	}*/
	
	// 获取STK内CRR信息
	var strTable = "";
	$("#_STKInfoListDiv").remove();
	var dColor = "#000000";
	// var dCrrID ="";
	var str = '<div id="_STKInfoListDiv" title=' + id
	+ '> ';
	str += '<span id="stkTitle">STK List Information(' + id
	+ ')</span>';
	str += '<img id="closeStkImg" src="image/close.gif" />';
	str += '</div>';
	$(str).appendTo('body');
	$("#closeStkImg").click(closeStkDiv);
	strTable = '<table id="_STKInfoListTbl" class="STKCrrListTbl" border="2" cellspacing="0" cellpadding="0"><tbody>';
	
	var dCnt = 39;
	if (id === "C1STK100" || id === "C1STK200") {
		dCnt = 45;
	}
	
	for ( var i = 4; i > 0; i--) {
		strTable += '<tr>';
	for ( var j = 1; j < dCnt; j++) {
		if (j < 10) {
			var rdID = '10' + j + '0' + i;
	var eqFlg = "N";
	for ( var ix = 0; ix < stkPortInforArray.length; ix++) {
		if (stkPortInforArray[ix].substr(10) == rdID) {
			var eqID = stkPortInforArray[ix].substr(1,9);
			strTable += '<td id="'
				+ rdID
				+ '" style="color:'
				+ dColor
				+ ';width:32px;height:32px;"><div id="'
				+ eqID + '">' + eqID
				+ '</div></td>';
		eqFlg = 'Y';
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
			+ rdID
			+ '" style="color:'
			+ dColor
			+ ';width:32px;height:32px;"></td>';
		}
	} else {
		var rdID = '1' + j + '0' + i;
	var eqFlg = "N";
	for ( var ix = 0; ix < stkPortInforArray.length; ix++) {
		if (stkPortInforArray[ix].substr(10) == rdID) {
			var eqID = stkPortInforArray[ix]
					.substr(1, 9);
			strTable += '<td id="'
				+ rdID
				+ '" style="color:'
				+ dColor
				+ ';width:32px;height:32px;"><div id="'
				+ eqID + '">' + eqID
				+ '</div></td>';
		eqFlg = 'Y';
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
			+ rdID
			+ '" style="color:'
			+ dColor
			+ ';width:32px;height:32px;"></td>';
	}
	// strTable+='<td id="'+'1'+j+'0'+i+'"
	// style="color:'+ dColor
	// +';width:32px;height:32px;"></td>';
		}
	
	}
	strTable += '</tr>';
	}
	
	strTable += '<tr style="background-color:#66CCFF;">';
	for ( var k = 1; k < dCnt; k++) {
		if (k < 10) {
			var porID = "10" + k + "01";
	var eqFlg = "N";
	for ( var iy = 0; iy < stkPortInforArray.length; iy++) {
		var setID = stkPortInforArray[iy].substr(10,
				5);
		if (porID.substr(0, 5) == setID) {
			var eqpID = stkPortInforArray[iy]
					.substr(1, 9);
			var portCnt = Number(stkPortInforArray[iy]
					.substr(0, 1));
			var showportCnt = portCnt;
			while (portCnt > 0) {
				strTable += '<td id="'
				+ porID
				+ '" style="width:32px;height:32px;"><div id="'
				+ portCnt
				+ eqpID
				+ '" style="text-align:center;width:50%;height:40%;margin-top:-20;margin-left:auto;margin-right:auto;z-index:10;background-color:#CCFF99">'
				+ (showportCnt - portCnt + 1)
				+ '</div></td>';
		portCnt--;
		if ((k + showportCnt - portCnt) > 9) {
			porID = "1"
					+ (k + showportCnt - portCnt)
					+ "01";
		} else {
			porID = "10"
					+ (k + showportCnt - portCnt)
					+ "01";
		}
	}
	k += Number(stkPortInforArray[iy]
			.substr(0, 1)) - 1;
	eqFlg = "Y";
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
		+ porID
		+ '" style="width:32px;height:32px;"></td>';
	}
	// strTable+='<td id="'+porID+'"
	// style="width:32px;height:32px;"><div></div></td>';
	} else {
		var porID = "1" + k + "01";
	var eqFlg = "N";
	for ( var iy = 0; iy < stkPortInforArray.length; iy++) {
		var setID = stkPortInforArray[iy].substr(10,
				5);
		if (porID.substr(0, 5) == setID) {
	
			var eqpID = stkPortInforArray[iy]
					.substr(1, 9);
			var portCnt = Number(stkPortInforArray[iy]
					.substr(0, 1));
			var showportCnt = portCnt;
			while (portCnt > 0) {
				strTable += '<td id="'
				+ porID
				+ '" style="width:32px;height:32px;"><div id="'
				+ portCnt
				+ eqpID
				+ '" style="text-align:center;width:50%;height:40%;margin-top:-20;margin-left:auto;margin-right:auto;z-index:10;background-color:#CCFF99">'
				+ (showportCnt - portCnt + 1)
				+ '</div></td>';
		portCnt--;
		porID = "1"
				+ (k + showportCnt - portCnt)
				+ "01";
	}
	k += Number(stkPortInforArray[iy]
			.substr(0, 1)) - 1;
	eqFlg = "Y";
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
		+ porID
		+ '" style="width:32px;height:32px;"></td>';
	}
	// strTable+='<td id="'+porID+'"
	// style="width:32px;height:32px;"><div></div></td>';
		}
	}
	strTable += '</tr>';
	
	for ( var i = 4; i > 0; i--) {
		strTable += '<tr>';
	for ( var j = 1; j < dCnt; j++) {
		if (j < 10) {
			var rdID = '20' + j + '0' + i;
	var eqFlg = "N";
	for ( var ix = 0; ix < stkPortInforArray.length; ix++) {
		if (stkPortInforArray[ix].substr(10) == rdID) {
			var eqID = stkPortInforArray[ix]
					.substr(1, 9);
			strTable += '<td id="'
				+ rdID
				+ '" style="color:'
				+ dColor
				+ ';width:32px;height:32px;"><div id="'
				+ eqID + '">' + eqID
				+ '</div></td>';
		eqFlg = 'Y';
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
			+ rdID
			+ '" style="color:'
			+ dColor
			+ ';width:32px;height:32px;"></td>';
	}
	// strTable+='<td id="'+'20'+j+'0'+i+'"
	// style="color:'+ dColor
	// +';width:32px;height:32px;"></td>';
	} else {
		var rdID = '2' + j + '0' + i;
	var eqFlg = "N";
	for ( var ix = 0; ix < stkPortInforArray.length; ix++) {
		if (stkPortInforArray[ix].substr(10) == rdID) {
			var eqID = stkPortInforArray[ix]
					.substr(1, 9);
			strTable += '<td id="'
				+ rdID
				+ '" style="color:'
				+ dColor
				+ ';width:32px;height:32px;"><div id="'
				+ eqID + '">' + eqID
				+ '</div></td>';
		eqFlg = 'Y';
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
			+ rdID
			+ '" style="color:'
			+ dColor
			+ ';width:32px;height:32px;"></td>';
	}
	// strTable+='<td id="'+'2'+j+'0'+i+'"
	// style="color:'+ dColor
	// +';width:32px;height:32px;"></td>';
		}
	}
	strTable += '</tr>';
	}
	
	strTable += '<tr style="background-color:#66CCFF;">';
	for ( var k = 1; k < dCnt; k++) {
		if (k < 10) {
			var porID = "20" + k + "01";
	var eqFlg = "N";
	for ( var iy = 0; iy < stkPortInforArray.length; iy++) {
		var setID = stkPortInforArray[iy].substr(10,
				5);
		if (porID.substr(0, 5) == setID) {
			var eqpID = stkPortInforArray[iy]
					.substr(1, 9);
			var portCnt = Number(stkPortInforArray[iy]
					.substr(0, 1));
			var showportCnt = portCnt;
			while (portCnt > 0) {
				strTable += '<td id="'
				+ porID
				+ '" style="width:32px;height:32px;"><div id="'
				+ portCnt
				+ eqpID
				+ '" style="text-align:center;width:50%;height:40%;margin-top:-20;margin-left:auto;margin-right:auto;z-index:10;background-color:#CCFF99">'
				+ portCnt + '</div></td>';
		portCnt--;
		if ((k + showportCnt - portCnt) > 9) {
			porID = "2"
					+ (k + showportCnt - portCnt)
					+ "01";
		} else {
			porID = "20"
					+ (k + showportCnt - portCnt)
					+ "01";
		}
	}
	k += Number(stkPortInforArray[iy]
			.substr(0, 1)) - 1;
	eqFlg = "Y";
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
		+ porID
		+ '" style="width:32px;height:32px;"></td>';
	}
	// strTable+='<td id="'+porID+'"
	// style="width:32px;height:32px;"><div></div></td>';
	} else {
		var porID = "2" + k + "01";
	var eqFlg = "N";
	for ( var iy = 0; iy < stkPortInforArray.length; iy++) {
		var setID = stkPortInforArray[iy].substr(10,
				5);
		if (porID.substr(0, 5) == setID) {
			var eqpID = stkPortInforArray[iy]
					.substr(1, 9);
			var portCnt = Number(stkPortInforArray[iy]
					.substr(0, 1));
			var showportCnt = portCnt;
			while (portCnt > 0) {
				strTable += '<td id="'
				+ porID
				+ '" style="width:32px;height:32px;"><div id="'
				+ portCnt
				+ eqpID
				+ '" style="text-align:center;width:50%;height:40%;margin-top:-20;margin-left:auto;margin-right:auto;z-index:10;background-color:#CCFF99">'
				+ portCnt + '</div></td>';
		portCnt--;
		porID = "2"
				+ (k + showportCnt - portCnt)
				+ "01";
	}
	k += Number(stkPortInforArray[iy]
			.substr(0, 1)) - 1;
	eqFlg = "Y";
			break;
		}
	}
	if (eqFlg == "N") {
	strTable += '<td id="'
		+ porID
		+ '" style="width:32px;height:32px;"></td>';
	}
	// strTable+='<td id="'+porID+'"
	// style="width:32px;height:32px;"><div></div></td>';
		}
	}
	strTable += '</tr>';
	
	strTable += '</tbody></table>';
	$(strTable).appendTo('#_STKInfoListDiv');
	$("#_STKInfoListDiv").css({
	"left" : "3%",
	"top" : "30%",
	"z-index" : "8",
	"position" : "fixed"
	});
	
	$("div[id^='A1']").css({
	"text-align" : "center",
	"color" : "red",
	"font-weight" : "bolder",
	"font-size" : "large"
	}).parent().attr("colspan", "3").next().remove().end()
			.next().remove();
	
	var stkArray = new Array();
	stkArray = stkLayOutInfo.split("/");
	for ( var x = 0; x < stkArray.length; x++) {
		var rdID = stkArray[x];
		// document.getElementById(rdID).style.backgroundColor='#999999';
	$("#" + rdID).css("background", "#FFFFFF");
	}
	
	for ( var y = 0; y < stkCrrListInfor.length; y++) {
		var rdID = stkCrrListInfor[y].shelfID;
		/*var myData={
				xfrshelfID : rdID
		}
		selData = JSON.stringify(myData);
		getCrrId(selData);
		var crr_id=crrIdInfos[0].crrID;
		var myData = {
				crrID : crr_id,		
			};
			selData = JSON.stringify(myData);
			//getCrrInfo(selData);
			$.ajax({
				type : "post",
			url : "crrInfoQuery.action",
			dataType : "json",
			async : false, // 决定ajax是否异步执行
			data : {
				selData : selData
			},
			timeout : 60000,
			success : function(data) {
				crrInfo = data.crrInfoList;// CRR信息
				$("#" + rdID).text(
						crrInfo[0].box_id.substring(2));
				}
			});*/
		/*$("#" + rdID).text(
				stkCrrListInfor[y].crrID.substring(2));*/
	if (stkCrrListInfor[y].crrStat == "EMPT") {
	$("#" + rdID).css("background", "#FFFF00");
	} else if (stkCrrListInfor[y].crrStat == "WAIT") {
	$("#" + rdID).css("background", "#00FF33");
	} else if (stkCrrListInfor[y].crrStat == "COMP") {
	$("#" + rdID).css("background", "#FF6600");
	} else if (stkCrrListInfor[y].crrStat == "HOLD") {
	$("#" + rdID).css("background", "#FF0000");
	} else if (stkCrrListInfor[y].crrStat == "INPR") {
	$("#" + rdID).css("background", "#0000FF");
	} else if (stkCrrListInfor[y].crrStat == "LOCK") {
	$("#" + rdID).css("background", "#CCBBFF");
		}
	}
	
	$("#_STKInfoListDiv").show();
	
	}
	
	function showEqptInfo(event) {
		var id = event.target.id;
		//id = id.substring(0, 9);
		var run = 0;
		var eng = 0;
		var idle = 0;
		var down = 0;
		var pm = 0;
		var OkQty=0;
		var NotOkQty=0;
		var Qty=0;
		if (id == "" || id == null || id == undefined
			|| id.length > 10) {
		return false;
	}
	/*var myData={
			eqptID:id
	};
	selData = JSON.stringify(myData);*/
	$.ajax({
				type : "post",
	url : "eqStatQuery.action",
	dataType : "json",
	data : {},
	timeout : 60000,
	success : function(data) {
		// 新增计算AE，OE，OEE机台状态总时间和
	dataList = data.aeqptstList;
	/*dataList1 = data.eqstatktlist;
	datalist2 = data.eqstatOklist;*/
	/*for ( var i = 0; i < dataList1.length; i++) {
		if (dataList1[i].eqptStat == "RUN") {
			run = run + dataList1[i].ktime;
		} else if (dataList1[i].eqptStat == "ENG") {
			eng = eng + dataList1[i].ktime;
		} else if (dataList1[i].eqptStat == "IDLE") {
			idle = idle
					+ dataList1[i].ktime;
		} else if (dataList1[i].eqptStat == "DOWN") {
			down = down
					+ dataList1[i].ktime;
		} else if (dataList1[i].eqptStat == "PM") {
			pm = pm + dataList1[i].ktime;
		}
	}
	for(var i=0;i < datalist2.length; i++){
		if(datalist2[i].prd_grade=="OK"){
			OkQty=OkQty+datalist2[i].prd_qty;
		}else{
			NotOkQty=NotOkQty+datalist2[i].prd_qty;
		}
	}
	Qty=OkQty+NotOkQty;
	var ae = 0;
	var oee=0;
	var oeTime = 0;
	var qe=OkQty/Qty;
	ae = (run + eng)
			/ (run + idle + eng);
	oeTime = (run + idle + eng)
			/ (run + idle + pm + down);
	oee=ae*qe;*/
	// alert(aeTime);
	// alert(oeTime);
	
	for ( var i = 0; i < dataList.length; i++) {
		if (id == dataList[i].eqptID) {
			if(dataList[i].eqptDsc && dataList[i].eqptID){
				$("#dEqpt")
				.html(
						dataList[i].eqptDsc
								.trim()
								+ "("
								+ dataList[i].eqptID
								+ ")");
			}
			if(dataList[i].eqptDsc){
				$("#dName").text(
						dataList[i].eqptDsc
								.trim());
			}
			
			$("#dStatus").text(
					dataList[i].eqptStat);
			$("#dMode").text(
					dataList[i].eqptMode);
			$("#dAlert").text(
					dataList[i].alrtFlg);
			$("#dWipCrr")
					.text(
							dataList[i].waitCrrCount);
			$("#dLoaderAssign")
					.text(
							dataList[i].ldCrrAsgnMode);
			$("#dUnloaderAssign")
					.text(
							dataList[i].ulCrrAsgnMode);
			if (dataList[i].wipCrrCount == null) {
				dataList[i].wipCrrCount = "";
			}
			$("#dWipCount")
									.text(
											dataList[i].wipCrrCount);
							break;
						}
					}
				}
			});
	var clientX = event.pageX;
	var clientY = event.pageY;
	var tWidth = event.clientX + $("#myMenu").width()
			- document.body.clientWidth;
	var tHeight = event.clientY + $("#myMenu").height()
			- document.body.clientHeight;
	if (tWidth > 0) {
		clientX = clientX - tWidth;
	}
	if (tHeight > 0) {
		clientY = clientY - tHeight;
	}
	$("#myMenu").css({
	"left" : clientX,
	"top" : clientY,
	"z-index" : "8"
	})
	$("#tipDiv").hide();
	$("#mainOperWipdiv").hide();
	$("#crrInfoMenu").hide();
	$("#myMenu").show();
	}
	
	function showCrrInfo(event) {
		$(".dtd2").text("");
	var id = event.target.id;
	id = id.substring(0, 12);	
	if (id == "" || id == null || id == undefined) {
		return false;
	}
	var eqptArray = new Array();
	eqptArray = id.split("-");
	var eqpt_id = eqptArray[0];
	var port_id = eqptArray[1];
	var myData = {
		eqptID : eqpt_id,
		portID : port_id
	}
	selData = JSON.stringify(myData);
	
	$("#dCrr").html(id);
	var clientX = event.pageX;
	var clientY = event.pageY;
	var tWidth = event.clientX + $("#crrInfoMenu").width()
			- document.body.clientWidth;
	var tHeight = event.clientY
			+ $("#crrInfoMenu").height()
			- document.body.clientHeight;
	if (tWidth > 0) {
		clientX = clientX - tWidth;
	}
	if (tHeight > 0) {
		clientY = clientY - tHeight;
	}
	$("#crrInfoMenu").css({
	"left" : clientX,
	"top" : clientY,
	"z-index" : "8"
	})
	if ($("#loadingImgDiv").length > 0) {
	$("#loadingImgDiv").remove();
	}
	$
			.ajax({
				type : "post",
	url : "crrOnPortQuery.action",
	dataType : "json",
	data : {
		selData : selData
	},
	beforeSend : function() {
		$("#loadingImgDiv").show();
	},
	complete : function() {
		$("#loadingImgDiv").hide();
	},
	success : function(data) {
		if (data.crrInfo != ""
			&& data.crrInfo != null
			&& data.crrInfo != undefined) {
		if (data.crrInfo.crrID != null
				&& data.crrInfo.crrID != undefined) {
			$("#dCrrId").text(
					data.crrInfo.crrID);
		}
		if (data.crrInfo.crrStat != null
				&& data.crrInfo.crrStat != undefined) {
			$("#dCrrStatus").text(
					data.crrInfo.crrStat);
		}
		if (data.crrInfo.lotID != null
				&& data.crrInfo.lotID != undefined) {
			$("#dLotID").text(
					data.crrInfo.lotID);
		}
		if (data.crrInfo.prodID != null
				&& data.crrInfo.prodID != undefined) {
			$("#dProdID").text(
					data.crrInfo.prodID);
		}
		if (data.crrInfo.routeID != null
				&& data.crrInfo.routeID != undefined) {
			$("#dRouteID").text(
					data.crrInfo.routeID);
		}
		if (data.crrInfo.routeVer != null
				&& data.crrInfo.routeVer != undefined) {
			$("#dRouteVer").text(
					data.crrInfo.routeVer);
		}
		if (data.crrInfo.opeID != null
				&& data.crrInfo.opeID != undefined) {
			$("#dOpeID").text(
					data.crrInfo.opeID);
		}
		if (data.crrInfo.opeVer != null
				&& data.crrInfo.opeVer != undefined) {
			$("#dOpeVer").text(
					data.crrInfo.opeVer);
		}
		if (data.crrInfo.procID != null
				&& data.crrInfo.procID != undefined) {
			$("#dProcID").text(
					data.crrInfo.procID);
		}
		if (data.crrInfo.frEqptID != null
				&& data.crrInfo.frEqptID != undefined) {
			$("#dFrEqptID").text(
					data.crrInfo.frEqptID);
		}
		if (data.crrInfo.frPortID != null
				&& data.crrInfo.frPortID != undefined) {
			$("#dFrPortID").text(
					data.crrInfo.frPortID);
		}
		if (data.crrInfo.frPatiID != null
				&& data.crrInfo.frPatiID != undefined) {
			$("#dFrPatiID").text(
					data.crrInfo.frPatiID);
		}
		if (data.crrInfo.frZoneID != null
				&& data.crrInfo.frZoneID != undefined) {
			$("#dFrZoneID").text(
					data.crrInfo.frZoneID);
		}
		if (data.crrInfo.toEqptID != null
				&& data.crrInfo.toEqptID != undefined) {
			$("#dToEqptID").text(
					data.crrInfo.toEqptID);
		}
		if (data.crrInfo.toPortID != null
				&& data.crrInfo.toPortID != undefined) {
			$("#dToPortID").text(
					data.crrInfo.toPortID);
		}
		if (data.crrInfo.toPatiID != null
				&& data.crrInfo.toPatiID != undefined) {
			$("#dToPatiID").text(
					data.crrInfo.toPatiID);
		}
		if (data.crrInfo.toZoneID != null
				&& data.crrInfo.toZoneID != undefined) {
			$("#dToZoneID").text(
					data.crrInfo.toZoneID);
		}
		if (data.crrInfo.xfCmdStat != null
				&& data.crrInfo.xfCmdStat != undefined) {
			$("#dXfCmdStat").text(
					data.crrInfo.xfCmdStat);
		}
		if (data.crrInfo.xfStat != null
				&& data.crrInfo.xfStat != undefined) {
			$("#dXfStat").text(
					data.crrInfo.xfStat);
		}
		if (data.crrInfo.lastXfrCmdRc != null
				&& data.crrInfo.lastXfrCmdRc != undefined) {
			$("#dLastXfrCmdRc")
					.text(
							data.crrInfo.lastXfrCmdRc);
		}
		if (data.crrInfo.lastLocRptRc != null
				&& data.crrInfo.lastLocRptRc != undefined) {
			$("#dLastLocRptRc")
					.text(
							data.crrInfo.lastLocRptRc);
		}
		if (data.crrInfo.posChgTimestamp != null
				&& data.crrInfo.posChgTimestamp != undefined) {
			$("#dPosChgTime")
					.text(
							data.crrInfo.posChgTimestamp);
		}
		$("#dRemark").text(
				data.crrInfo.remark);
		if(data.crrInfo.crrStat==="EMPT"){
			$("#dCrrId").css("background","red");
		}
		if(data.crrInfo.crrStat=="WAIT"){
			$("#dCrrId").css("background","none");
		}
	} else {
		$(".dtd2").text("");
		$("#dRemark").text("端口上的卡匣信息为空！");
					}
				}
			});
	
	$("#tipDiv").hide();
	$("#mainOperWipdiv").hide();
	$("#myMenu").hide();
	$("#crrInfoMenu").show();
	}
	
	$("#crrListGrd").jqGrid(
	{
		url : "",
	datatype : "local",
	mtype : "POST",
	// width : 200,
	height : 350,
	rowNum : 100,
	rownumWidth : true,
	shrinkToFit : true,
	scroll : true,
	colNames : [ 'Carrier ID', 'Lot ID', 'Prod ID',
	'Next Ope ID', 'Position', 'Port',
	'Zone', 'Change Timestamp',
	'From Equipment', 'From Port',
	'From Zone', 'To Equipment', 'To Port',
	'To Zone' ],
	colModel : [ {
		name : 'crrID',
	index : 'crrID',
	width : 100,
	align : "left",
	sortable : "true"
	}, {
		name : 'lotID',
	index : 'lotID',
	width : 80,
	align : "left",
	sortable : "true"
	}, {
		name : 'prodID',
	index : 'prodID',
	width : 90,
	align : "left",
	sortable : "true"
	}, {
		name : 'opeID',
	index : 'opeID',
	width : 90,
	align : "left",
	sortable : "true"
	}, {
		name : 'position',
	index : 'position',
	width : 80,
	align : "left",
	sortable : "true"
	}, {
		name : 'portID',
	index : 'portID',
	width : 50,
	align : "left",
	sortable : "true"
	}, {
		name : 'zoneID',
	index : 'zoneID',
	width : 50,
	align : "left",
	sortable : "true"
	}, {
		name : 'posChgTimestamp',
	index : 'posChgTimestamp',
	width : 150,
	align : "left",
	sortable : "true"
	}, {
		name : 'frEqptID',
	index : 'frEqptID',
	width : 120,
	align : "left",
	sortable : "true"
	}, {
		name : 'frPortID',
	index : 'frPortID',
	width : 80,
	align : "left",
	sortable : "true"
	}, {
		name : 'frZoneID',
	index : 'frZoneID',
	width : 80,
	align : "left",
	sortable : "true"
	}, {
		name : 'toEqptID',
	index : 'toEqptID',
	width : 120,
	align : "left",
	sortable : "true"
	}, {
		name : 'toPortID',
	index : 'toPortID',
	width : 80,
	align : "left",
	sortable : "true"
	}, {
		name : 'toZoneID',
	index : 'toZoneID',
	width : 80,
	align : "left",
	sortable : "true"
	}
	
	],
	viewrecords : true,
	pager : '#crrListPg'
			});
	
	$.ajaxSetup({
		timeout : 30000,
		error : function(httpException) {
			showMessage("失败，请重试！");
		}
	});
	
	var comBean = {
		loadCrrInfo : function() {
			$
					.ajax({
						type : "post",
	url : "crrInfo/loadCrrSort",
	dataType : "json",
	/*
	 * data : { selData : selData },
	 */
	beforeSend : function() {
		$("#loadingImgDiv").show();
	},
	complete : function() {
		$("#loadingImgDiv").hide();
	},
	success : function(data) {
		// alert(data);
		if(data.dcarrixfPOList.length === 0){
			return false;
		}
		var oary =data.dcarrixfPOList;
		$("#crrInfoSort").html("");
		var htmlStr = "";
		for ( var i = 0; i < oary.length; i++) {
			
			var j = parseInt(i) + 1;
			htmlStr += '<tr style="color:'
					+ oary[i].color
					+ '"><td style="width:70px">'
					+ j
					+ '</td><td style="width:100px">'
					+ oary[i].crr_id
					+ '</td><td style="width:90px">'
					+ oary[i].crr_stat
					+ '</td><td style="width:100px">'
					+ oary[i].fr_eqpt_id
					+ '</td><td style="width:90px">'
					+ oary[i].fr_port_id
					+ '</td><td style="width:110px">'
					+ oary[i].to_eqpt_id
					+ '</td><td style="width:90px">'
					+ oary[i].to_port_id
					+ '</td><td style="width:80px">'
					+ oary[i].priority
					+ '</td><td>'
					+ oary[i].load_timestamp
					+ '</td><tr>';
	
		}
		$("#crrInfoSort").html(htmlStr);
	
					}
				});
	},
	
	stkStatFnc :function(){
		var stk_id1="C1STK100";
		var myData = {
				stk_id : stk_id1
			};
			selData = JSON.stringify(myData);
			getStkInfor(selData);
			var stkstat=stkStat[0];
			var stk_stat=stkstat.stk_stat;
			if(stk_stat=="RUN"){
				var obj = document.getElementById(stk_id1);
				obj.setAttribute("fill", "#27E527");
			}
			if(stk_stat=="DOWN"){
				var obj = document.getElementById(stk_id1);
				obj.setAttribute("fill", "#E74C3C");
			}
			if(stk_stat=="IDLE"){
				var obj = document.getElementById(stk_id1);
				obj.setAttribute("fill", "#F2F20C");
			}
			
			var stk_id2="C1STK200";
			var myData = {
					stk_id : stk_id2
				};
				selData = JSON.stringify(myData);
				getStkInfor(selData);
				var stkstat=stkStat[0];
				var stk_stat=stkstat.stk_stat;
				if(stk_stat=="RUN"){
					var obj = document.getElementById(stk_id2);
					obj.setAttribute("fill", "#27E527");
				}
				if(stk_stat=="DOWN"){
					var obj = document.getElementById(stk_id2);
					obj.setAttribute("fill", "#E74C3C");
				}
				if(stk_stat=="IDLE"){
					var obj = document.getElementById(stk_id2);
					obj.setAttribute("fill", "#F2F20C");
				}
	},
	stkFullAlarmFnc : function(stk_id) {
		var obj = document.getElementById(stk_id);
		var timer = null;
		var i = 0;
		// var color = obj.getAttribute("fill");
	clearInterval(timer);
	timer = setInterval(function() {
		obj.setAttribute("fill", "#FFCCCC");
	obj.style.display = i++ % 2 ? "none" : "block";// 还是有收获的，这个写法比if..else想必简单了好多
	i > 40 && clearInterval(timer);// 这个短路用的经典啊
	if (i >= 40) {
		//obj.setAttribute("fill", "#F0F0F0");
		comBean.stkStatFnc();
			}
		}, 250);
	},
	
	crrOnPortAlarmFnc : function(eqptPortID) {
		var obj = document.getElementById(eqptPortID);
		var timer = null;
		var i = 0;
		var color = obj.getAttribute("fill");
	clearInterval(timer);
	timer = setInterval(function() {
		obj.setAttribute("fill", "red");
	obj.style.display = i++ % 2 ? "none" : "block";// 还是有收获的，这个写法比if..else想必简单了好多
	i > 40 && clearInterval(timer);// 这个短路用的经典啊
	if (i >= 40) {
		obj.setAttribute("fill", color);
			}
		}, 250);
	},
	
	loadStkInfoFnc : function() {
		$
				.ajax({
					type : "post",
	url : "crrInfo/eqptBayInfoQuery",
	dataType : "json",
	// async : false, //决定ajax是否异步执行
	timeout : 60000,
	success : function(data) {
		if(data.stockerPOList.length===0){
			return false;
		}
		var oary =data.stockerPOList;
		$("#stkInfo").html("");
		var htmlStr="";
		for ( var i = 0; i < oary.length; i++) {
			var j = parseInt(i) + 1;
			htmlStr += '<tr style="color:'
					+ oary[i].ext_1
					+ '"><td style="width:60px">'
					+ j
					+ '</td><td style="width:140px">'
					+ oary[i].stk_id
					+ '</td><td style="width:80px">'
					+ oary[i].use_time
					+ '</td><td style="width:100px">'
					+ oary[i].isFull
					+ '</td><td style="width:90px">'
					+ oary[i].use_cnt
					+ '</td><td style="width:90px">'
					+ oary[i].thres_hold
					+ '</td><tr>';
	
			// if(oary[i].use_cnt >=
			// oary[i].thres_hold ||
			// parseInt(oary[i].use_time) >=
			// 30){
			// comBean.stkFullAlarmFnc(oary[i].stk_id);
			// }
			if (oary[i].stk_id == "C1STK100"
					|| oary[i].stk_id == "C1STK200") {
				comBean
						.stkFullAlarmFnc(oary[i].stk_id);
			}
	
		}
		$("#stkInfo").html(htmlStr);
					}
				});
	},
	
	InitPageFnc : function() {
		$("#opeSel").val("ALL");
	document.getElementById("layout").setAttribute(
	"style", "display");
	document.getElementById("layout").setAttribute(
	"style", "display:block");
	document.getElementById("layout").setAttribute(
	"style", "display:block");
	
	// document.getElementById("layout_tf_").setAttribute("style","display");
	// document.getElementById("layout_tf_").setAttribute("style","display:none");
	// document.getElementById("layout_tf_").setAttribute("style","display:none");
	
	// document.getElementById("layout_etc").setAttribute("style","display");
	// document.getElementById("layout_etc").setAttribute("style","display:none");
	// document.getElementById("layout_etc").setAttribute("style","display:none");
	//			
	// document.getElementById("layout_pho").setAttribute("style","display");
	// document.getElementById("layout_pho").setAttribute("style","display:none");
	// document.getElementById("layout_pho").setAttribute("style","display:none");
	//			
	// document.getElementById("layout_tst").setAttribute("style","display");
	// document.getElementById("layout_tst").setAttribute("style","display:none");
	// document.getElementById("layout_tst").setAttribute("style","display:none");
	//			
	// document.getElementById("layout_fa_").setAttribute("style","display");
	// document.getElementById("layout_fa_").setAttribute("style","display:none");
	// document.getElementById("layout_fa_").setAttribute("style","display:none");
	},
	
	showDiffFnc : function() {
		// alert($("#opeSel").val());
	if ($("#opeSel").val() === 'TF') {
	document.getElementById("layout").setAttribute(
	"style", "display");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	
	document.getElementById("layout_tf_")
	.setAttribute("style", "display");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:block");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:block");
	
	document.getElementById("layout_etc")
	.setAttribute("style", "display");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_pho")
	.setAttribute("style", "display");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_tst")
	.setAttribute("style", "display");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_fa_")
	.setAttribute("style", "display");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	} else if ($("#opeSel").val() === 'ETCH') {
	document.getElementById("layout").setAttribute(
	"style", "display");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	
	document.getElementById("layout_tf_")
	.setAttribute("style", "display");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_etc")
	.setAttribute("style", "display");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:block");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:block");
	
	document.getElementById("layout_pho")
	.setAttribute("style", "display");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_tst")
	.setAttribute("style", "display");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_fa_")
	.setAttribute("style", "display");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	} else if ($("#opeSel").val() === 'PHO') {
	document.getElementById("layout").setAttribute(
	"style", "display");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	
	document.getElementById("layout_tf_")
	.setAttribute("style", "display");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_etc")
	.setAttribute("style", "display");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_pho")
	.setAttribute("style", "display");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:block");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:block");
	
	document.getElementById("layout_tst")
	.setAttribute("style", "display");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_fa_")
	.setAttribute("style", "display");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	} else if ($("#opeSel").val() === 'TEST') {
	document.getElementById("layout").setAttribute(
	"style", "display");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	
	document.getElementById("layout_tf_")
	.setAttribute("style", "display");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_etc")
	.setAttribute("style", "display");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_pho")
	.setAttribute("style", "display");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_tst")
	.setAttribute("style", "display");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:block");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:block");
	
	document.getElementById("layout_fa_")
	.setAttribute("style", "display");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	} else if ($("#opeSel").val() === 'FA') {
	document.getElementById("layout").setAttribute(
	"style", "display");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	document.getElementById("layout").setAttribute(
	"style", "display:none");
	
	document.getElementById("layout_tf_")
	.setAttribute("style", "display");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_etc")
	.setAttribute("style", "display");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_pho")
	.setAttribute("style", "display");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_tst")
	.setAttribute("style", "display");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_fa_")
	.setAttribute("style", "display");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:block");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:block");
	} else {
		document.getElementById("layout").setAttribute(
	"style", "display");
	document.getElementById("layout").setAttribute(
	"style", "display:block");
	document.getElementById("layout").setAttribute(
	"style", "display:block");
	
	document.getElementById("layout_tf_")
	.setAttribute("style", "display");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tf_")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_etc")
	.setAttribute("style", "display");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	document.getElementById("layout_etc")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_pho")
	.setAttribute("style", "display");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	document.getElementById("layout_pho")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_tst")
	.setAttribute("style", "display");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	document.getElementById("layout_tst")
	.setAttribute("style", "display:none");
	
	document.getElementById("layout_fa_")
	.setAttribute("style", "display");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
	document.getElementById("layout_fa_")
	.setAttribute("style", "display:none");
			}
		}
	};
	
	comBean.loadStkInfoFnc();
	
	crrOnPortInfo();
	setInterval(function() {
		comBean.loadStkInfoFnc();
		crrOnPortInfo();
	}, 20000);
	
	comBean.InitPageFnc();
	comBean.stkStatFnc();
	
	$("#opeSel").change(function() {
		comBean.showDiffFnc();
	});
	
	// $("rect").click(function (){
	// alert(this.id.substring(0,11));
	// });
	
					});
	function showSuccessDialog(str){
		 bootbox.dialog({
			 message : "<center><h3>" + str + "</h3></center>",
	 buttons:{
		 success:{
			 label:"Success!",
	 className:"btn-success",
				 }
			 }
		 })
	 }
	
	 function showErrorDialog( errCode , errMsg){
	 	var str = "<center><h3 class='errorAlert'>"+ errCode +"</h3></center>"+"<br/>"+
	   "<center><h3 class='errorAlert'>"+ errMsg +"</h3></center>";
	 
	    bootbox.alert(str);
	 }
